/*
day215
2020.3.30
*/
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int longestMountain(vector<int>& A) {
    	if(A.empty()) return 0; 
    	int size=A.size();
    	int res=0;
		vector<int> left(size),right(size);
		
		left[0]=right[size-1]=0;
		for(int i=1;i<size;++i)
		{
			left[i]=0;
			if(A[i]>A[i-1])
			{
				left[i]=left[i-1]+1;
			}
		}
		
		for(int i=size-2;i>=0;--i)
		{
			right[i]=0;
			if(A[i]>A[i+1])
			{
				right[i]=right[i+1]+1;
			}
		}
		
		for(int i=1;i<size-1;++i)
		{
			int tem;
			if(left[i]==0 || right[i]==0)
			{
				tem=0;
			}
			else
			{
				tem=left[i]+right[i]+1;
			}
			
			if(tem>res)
			{
				res=tem;
			}
		}
		
		return res;
    }
};

int main()
{
	vector<int> A={0,1,2,3,4,5,6,7,8,9};
	Solution s;
	cout<<s.longestMountain(A)<<endl;
	return 0;
}
